fix: 멘토링 등록 계약과 경력 입력 검증 흐름을 정합하게 수정#442
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 Walkthrough개요멘토 프로필의 핵심 키워드 타입을 확장하고, 키워드 읽기 로직을 리팩토링하며, 경력 항목의 "현재 직책" 상태 관리를 개선하고 온보딩 메시지에 이모지를 추가했습니다. 변경 사항
예상 코드 리뷰 노력🎯 3 (보통) | ⏱️ ~20분 관련 가능성 있는 PR
시
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/features/mentoring/model/use-mentor-registration-controller.ts (1)
1326-1332: 성공 메시지 간 표시 일관성을 맞춰주세요.Line 1332에만 ✅ 이모지가 추가되었지만, 동일한 저장 성공 시나리오를 나타내는 Line 1329와 Line 1331의 제목에는 이모지가 없어 일관성이 떨어집니다. 세 가지 타이틀 모두 저장 완료 상태를 안내하는 메시지이므로, 사용자 경험 통일을 위해 다음 중 한 가지 방법을 권장합니다:
- 세 가지 타이틀 모두에 ✅ 이모지를 추가하거나
- Line 1332에서 이모지를 제거하여 나머지와 동일하게 유지
♻️ 일관성 개선 제안 (옵션 1: 모든 성공 메시지에 이모지 추가)
setWelcomeOnboarding({ mentorId, title: isApplyReady - ? '저장은 완료되었고 신청 가능 상태로 반영됩니다' + ? '✅ 저장은 완료되었고 신청 가능 상태로 반영됩니다' : isDetailPreparing - ? '저장은 완료되었지만 공개 준비가 더 필요합니다' + ? '✅ 저장은 완료되었지만 공개 준비가 더 필요합니다' : '✅ 저장은 완료되었고 상세 공개 준비 상태로 반영됩니다',🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/features/mentoring/model/use-mentor-registration-controller.ts` around lines 1326 - 1332, The three success titles set via setWelcomeOnboarding({ mentorId, title: ... }) are inconsistent: only the third branch (when not isApplyReady and not isDetailPreparing) includes the ✅ emoji; update the three title strings for the ternary branches (the isApplyReady branch, the isDetailPreparing branch, and the final branch) to be consistent by either adding ✅ to the first two titles or removing ✅ from the third so all three match; locate this logic around the setWelcomeOnboarding call in use-mentor-registration-controller.ts and update the title strings accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/features/mentoring/ui/registration/mentor-career-entries-editor.tsx`:
- Around line 233-235: 현재 clearErrors('careerEntries') 호출이 배열 루트와 그 하위 모든
필드(careerEntries.*)의 오류를 전부 제거하여, 바로 앞 setValue(..., { shouldValidate: true })로
재검증된 다른 행의 오류까지 숨기고 검증 흐름을 망가뜨립니다; 이를 고치려면 clearErrors 호출을 범위를 좁혀서 현재 행의
endMonth와 (필요시) 해당 행의 관련 필드만 지우도록 변경하세요(예:
clearErrors([`careerEntries.${index}.endMonth`]) 대신 전체 루트를 지우지 않음), 관련 심볼:
clearErrors, setValue, careerEntries, index, nextIsCurrent를 찾아 위와 같이 대상 필드만
제거되도록 수정하세요.
---
Nitpick comments:
In `@src/features/mentoring/model/use-mentor-registration-controller.ts`:
- Around line 1326-1332: The three success titles set via setWelcomeOnboarding({
mentorId, title: ... }) are inconsistent: only the third branch (when not
isApplyReady and not isDetailPreparing) includes the ✅ emoji; update the three
title strings for the ternary branches (the isApplyReady branch, the
isDetailPreparing branch, and the final branch) to be consistent by either
adding ✅ to the first two titles or removing ✅ from the third so all three
match; locate this logic around the setWelcomeOnboarding call in
use-mentor-registration-controller.ts and update the title strings accordingly.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 7bb6bf9b-fe3d-4960-bd38-7e6dde03a395
📒 Files selected for processing (4)
src/features/mentoring/api/mentor-api.types.tssrc/features/mentoring/api/mentor-core-keyword-contract.tssrc/features/mentoring/model/use-mentor-registration-controller.tssrc/features/mentoring/ui/registration/mentor-career-entries-editor.tsx
| if (nextIsCurrent) { | ||
| clearErrors([`careerEntries.${index}.endMonth`, 'careerEntries']); | ||
| } |
There was a problem hiding this comment.
🧩 Analysis chain
🌐 Web query:
In react-hook-form, does clearErrors('careerEntries') also clear nested errors like careerEntries.0.description and careerEntries.0.endMonth, or only the root array error?
💡 Result:
In react-hook-form, calling clearErrors('careerEntries') clears both the root array error (if any) and all nested errors like careerEntries.0.description and careerEntries.0.endMonth. This is the expected behavior, as confirmed by the official documentation and GitHub issues. The official clearErrors documentation explicitly states: register("test.firstName", { required: true }) register("test.lastName", { required: true }) clearErrors("test") // will clear both errors from test.firstName and test.lastName clearErrors("test.firstName") // for clear single input error This demonstrates that clearing a parent field name removes all errors under that path, including nested ones. GitHub issue #8476 confirms this for field arrays: maintainer @bluebill1049 states "This is expected behavior" when clearErrors on a field array root clears nested field errors. They note there's no built-in way to clear only the root without affecting nested errors—you must specify exact nested paths. This behavior has been consistent across versions, with fixes ensuring clearErrors on a path clears the entire subtree (e.g., issues #2730, #2961).
Citations:
- 1: https://react-hook-form.com/docs/useform/clearerrors
- 2: issue: Nested errors cleared when clearErrors called with field array root react-hook-form/react-hook-form#8476
clearErrors('careerEntries')로 다른 행의 유효성 검사 오류까지 함께 제거됩니다.
clearErrors('careerEntries')는 배열 루트 오류뿐만 아니라 careerEntries.0.description, careerEntries.0.endMonth 같은 중첩 필드의 모든 오류를 함께 제거합니다. 바로 앞의 setValue(..., { shouldValidate: true })로 재계산된 다른 행의 유효성 검사 오류가 숨겨져서 검증 흐름이 불일치할 수 있습니다.
수정안
- if (nextIsCurrent) {
- clearErrors([`careerEntries.${index}.endMonth`, 'careerEntries']);
- }
+ if (nextIsCurrent) {
+ clearErrors(`careerEntries.${index}.endMonth`);
+ }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/features/mentoring/ui/registration/mentor-career-entries-editor.tsx`
around lines 233 - 235, 현재 clearErrors('careerEntries') 호출이 배열 루트와 그 하위 모든
필드(careerEntries.*)의 오류를 전부 제거하여, 바로 앞 setValue(..., { shouldValidate: true })로
재검증된 다른 행의 오류까지 숨기고 검증 흐름을 망가뜨립니다; 이를 고치려면 clearErrors 호출을 범위를 좁혀서 현재 행의
endMonth와 (필요시) 해당 행의 관련 필드만 지우도록 변경하세요(예:
clearErrors([`careerEntries.${index}.endMonth`]) 대신 전체 루트를 지우지 않음), 관련 심볼:
clearErrors, setValue, careerEntries, index, nextIsCurrent를 찾아 위와 같이 대상 필드만
제거되도록 수정하세요.
🌱 연관된 이슈
☘️ 작업 내용
🍀 참고사항
스크린샷 (선택)
Summary by CodeRabbit
릴리스 노트
새로운 기능
개선사항